package flexUnitTests
{
	import com.zheng.russiaRec.model.utils.U_GetInfoFromArr;
	
	import flexunit.framework.Assert;
	
	public class U_GetInfoFromArrTester
	{		
		private var getInfoFromArr:U_GetInfoFromArr=new U_GetInfoFromArr();
		[Before]
		public function setUp():void
		{
		}
		
		[After]
		public function tearDown():void
		{
		}
		
		[BeforeClass]
		public static function setUpBeforeClass():void
		{
		}
		
		[AfterClass]
		public static function tearDownAfterClass():void
		{
		}
		
		[Test]
		public function testGetMinDis():void
		{
			var arr1:Array=[[1,3],[1,2],[2,5]];
			var arr2:Array=[[1,22],[1,20],[2,17]];
			var resultNum:int=getInfoFromArr.getMinDis(arr1,arr2,20);
			Assert.assertEquals(resultNum,12);
		}
		
		[Test]
		public function testGetColsScope():void
		{
			var testArr:Array=[[1,1],[2,1],[2,2],[3,1],[1,0]];
			var resultArr:Array = getInfoFromArr.getColsScope(testArr);
			Assert.assertEquals(resultArr.length,3);
		}
		
		[Test]
		public function testGetRecVosByArr():void
		{
			var testArr:Array=[[1,1],[2,1],[2,2],[3,2]];
			var resultArr:Array=getInfoFromArr.getRecVosByArr(testArr,[1,2,3],true);
			Assert.assertObjectEquals(resultArr,[[1,1],[2,2],[3,2]]);
		}
		
		[Test]
		public function testGetRecVosByCols():void
		{
			var testArr:Array=[[1,2],[2,3],[3,4],[3,3],[4,5],[8,1],[1,1],[3,5]];
			var resultArr:Array=getInfoFromArr.getRecVosByCols(testArr,3,false);
			var isTrue:Boolean=(resultArr[1]==3);
			Assert.assertTrue(isTrue);
		}
		[Test]
		public function testGetRecVosByCols2():void
		{
			var testArr:Array=[[1,2],[2,3],[3,4],[3,3],[4,5],[8,1],[1,1],[3,5]];
			var resultArr:Array=getInfoFromArr.getRecVosByCols(testArr,3,true);
			var isTrue:Boolean=(resultArr[1]==5);
			Assert.assertTrue(isTrue);
		}
		[Test]
		public function testGetDis():void
		{
			var recVo1:Array=[5,2];
			var recVo2:Array=[5,20];
			var result:int=getInfoFromArr.getDis(recVo1,recVo2);
			Assert.assertEquals(result,18);
		}
	}
}